
import 'dart:async';

/// stream 主要是为了实现消息通信方案
void main(){
  StreamController controller = StreamController.broadcast();

  controller.stream.listen((event) {
    print("监听1：$event");
  });

  //单一订阅模式下二次监听报错
  controller.stream.listen((event) {
    print("监听2：$event");
  });

  controller.sink.add("abc");
  controller.sink.add("123");
}
